package Animal;

public class Test {
    public static void main(String[] args) {
        Student stu=new Student("张三");
        Cat cat=new Cat("小花");
        stu.feed(cat);
        Dog dog=new Dog("大黄");
        stu.feed(dog);
        Pig pig=new Pig("胖胖");
        stu.feed(pig);
        stu.feed(new Animal("小白") {//匿名内部类
            @Override
            public void shout() {
                System.out.println("咯咯咯~~~~");
            }
        });
    }
    //内部类
    static class Pig extends Animal{

        public Pig(String name) {
            super(name);
        }

        @Override
        public void shout() {
            System.out.println("哼哼哼");

        }
    }
}
